perm filename DEBUG.PAL[SYS,HE] blob sn#142394 filedate 1975-02-07 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.SBTTL	debugging routine - types current window and waits for response
C00005 00003	.SBTTL	debugging routine - types window location in octal
C00006 ENDMK
CāŠ—;
.SBTTL	debugging routine - types current window and waits for response

ADDR:	0			;address of start of this line
CHRCNT:	0			;number of current char in current word
LININC:	0			;increment to get start of next line
LINCNT:	0			;number of bytes in this line
TOTCNT:	0			;number of bytes in window

DEB:	MOV A,DBOUT		;output message pointed to by A
	JSR A,TYPSTR
DBOUT:	CRLFX
	CRLF
	MOV PAR,ADDR		;save starting address
	ASL ADDR		;	in bytes
	MOV PAR+4,LININC	;save increment to next line
	ASL LININC		;	also in bytes
	MOV PAR+10,TOTCNT	;save total count
LINLOP:	MOV PAR+2,CHRCNT	;start of line loop - get initial char count
	MOV PAR+6,LINCNT	;and byte count for this line
	MOV ADDR,A		;current word address in A
DBL2:	MOV (A),B		;unpack next 4-bit byte in B
	MOV CHRCNT,LENG
	SUB #3,LENG
	MUL #4,LENG
	ASHC LENG,B
	BIC #177760,B
	CMP #10.,B		;and output
	BHI DBL
	ADD #7,B
DBL:	JSR PC,TYPOUT
	MOV #40,B		;followed by blank
	JSR PC,TYPCHR
	INC CHRCNT		;space to next byte
	CMP #4,CHRCNT
	BHI DBL1
	CLR CHRCNT		;and to next word if overflow
	ADD #2,A
DBL1:	DEC TOTCNT
	BLE DBL3		;end of output
	DEC LINCNT
	BGT DBL2
	CRLF			;end of line
	ADD LININC,ADDR
	BR LINLOP

DBL3:	CRLF
	MOV #'T,B		;wait for input
	JSR PC,TYPCHR
	TTYIN B
	RTS PC
.SBTTL	debugging routine - types window location in octal

;	X, Y are in B and C
;	must be called at start of SETPAR
;	restores B and C

XC:	0
YC:	0

PRTSTR:	MOV B,XC
	MOV C,YC
	NUMOCT XC
	MOV #',,B
	JSR PC,TYPCHR
	NUMOCT YC
	CRLF
	MOV XC,B
	MOV YC,C
	RTS PC